package com.app.brilliant.game.service.impl;
import com.app.brilliant.common.service.impl.BaseServiceImpl;
import com.app.brilliant.game.bean.BriOrder;
import com.app.brilliant.game.service.BriOrderService;
import com.app.brilliant.game.mapper.BriOrderMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author GF
* @description 针对表【bri_order】的数据库操作Service实现
* @createDate 2025-08-27 16:01:44
*/
@Service
public class BriOrderServiceImpl extends BaseServiceImpl<BriOrderMapper, BriOrder>
implements BriOrderService{

    @Override
    public List<BriOrder> getUnpaidOrders() {
        return baseMapper.selectList(new QueryWrapper<BriOrder>()
                .eq("status", 0) // 假设0表示未支付状态
                .orderByDesc("create_time"));
    }

    @Override
    public void batchCancelUnpaidOrders() {
        baseMapper.batchCancelUnpaidOrders();
    }

    @Override
    public BriOrder getByOrderNumberAndUserId(String orderNumber, Long userId) {
        return baseMapper.selectOne(new QueryWrapper<BriOrder>()
                .eq("order_number", orderNumber)
                .eq("uid", userId));
    }
}
